<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function Father(uname, age, gender) {

            this.uname = uname

            this.age = age

            this.gender = gender
        }

        Father.prototype.money = function () {
            console.log('赚了一个小目标')
        }

        function Son(uname, age, gender) {
            // 修改this指向
            Father.call(this, uname, age, gender)
        }
        //    把Son的原型指向改成 Father的实例化
        Son.prototype = new Father()
        // 手动指回构造函数
        Son.prototype.constructor = Son

        const son = new Son('小明', 18, '女')
        console.log(son);

        son.money()

    </script>
</body>

</html>